package {
	import flash.display.GradientType;
	import flash.display.Graphics;
	import flash.display.SpreadMethod;
	import flash.display.Sprite;
	import flash.geom.Matrix;

	public class BallSprite extends Sprite {
		
		private static var RADIUS:Number = 30;
		private static var COLORS:Array = [0xFF6666, 0x66FF66, 0xFFFF66, 0x6666FF];
		
		public function BallSprite() {
			super();
			
			var colorIndex:uint = uint(Math.random() * COLORS.length);
			var color:uint = COLORS[colorIndex];
			var g:Graphics = graphics;
			
			var mat:Matrix = new Matrix();
			mat.createGradientBox(RADIUS * 2.1, RADIUS * 2.1, 0, -RADIUS * 1.2, -RADIUS * 1.2);
			g.beginGradientFill(GradientType.RADIAL, [color, 0], [1, 1], [0x00, 0xFF], mat, SpreadMethod.PAD); 
			g.drawCircle(0, 0, RADIUS);
			g.endFill();
			
		}
	}
}